# -*- coding: utf-8 -*-
"""
本文档存储所有武器的信息
"""

__authur__ = 'Yu XH'


import numpy as np
from myAI.const import *


class Biggun(object):
    """大号直瞄炮"""
    def __init__(self):
        self.id = 36
        self.type = BulletType.Convention
        self.shoot_range = {BopType.Infantry: 10,
                            BopType.Vehicle: 18,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        # 基于距离的攻击等级数值，数组长度为21（0~20的距离），距离为0的att_level_car[0]表示同格的攻击等级
        self.att_level_car = np.array([10, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 7, 7, 6, 5, 4, 3, 2, 0, 0])
        self.att_level_soldier = np.array([[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])


class Middlegun(object):
    """中号直瞄炮"""
    def __init__(self):
        self.id = 37
        self.type = BulletType.Convention
        self.shoot_range = {BopType.Infantry: 10,
                            BopType.Vehicle: 15,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([10, 10, 10, 9, 9, 9, 8, 8, 7, 7, 7, 6, 5, 5, 2, 2, 0, 0, 0, 0, 0])
        self.att_level_soldier = np.array([[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])


class Littlegun(object):
    """小号直瞄炮"""
    def __init__(self):
        self.id = 54
        self.type = BulletType.Convention
        self.shoot_range = {BopType.Infantry: 10,
                            BopType.Vehicle: 13,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([10, 10, 9, 9, 8, 8, 7, 6, 6, 5, 5, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0])
        self.att_level_soldier = np.array([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])


class QuickFiringGun(object):
    """ 速射炮"""
    def __init__(self):
        self.id = 56
        self.type = BulletType.Convention
        self.shoot_range = {BopType.Infantry: 10,
                            BopType.Vehicle: 10,
                            BopType.Aircraft: 5}  # 射程，0表示不可射击
        self.att_level_car = np.array([5, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        self.att_level_soldier = np.array([[4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [6, 6, 6, 6, 6, 6, 5, 5, 4, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [9, 9, 9, 9, 9, 9, 8, 8, 7, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
        self.att_level_aircraft = np.array([3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])


class RocketLauncher(object):
    """火箭筒"""
    def __init__(self):
        self.id = 35
        self.type = BulletType.Convention
        self.shoot_range = {BopType.Infantry: 0,
                            BopType.Vehicle: 4,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([6, 6, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])


class SoldierWeapon(object):
    """步兵轻武器"""
    def __init__(self):
        self.id = 29
        self.type = BulletType.Convention
        self.shoot_range = {BopType.Infantry: 3,
                            BopType.Vehicle: 3,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])  # 此处做了近似处理，让期望结果近似一致
        self.att_level_soldier = np.array([[2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [6, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [8, 5, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])


class LightWeapons(object):
    """车载轻武器"""
    def __init__(self):
        self.id = 43
        self.type = BulletType.Convention
        self.shoot_range = {BopType.Infantry: 10,
                            BopType.Vehicle: 0,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_soldier = np.array([[2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])


class PortableMissile(object):
    """便携导弹"""
    def __init__(self):
        self.id = 71
        self.type = BulletType.HeavyMissile
        self.shoot_range = {BopType.Infantry: 0,
                            BopType.Vehicle: 10,
                            BopType.Aircraft: 10}  # 射程，0表示不可射击
        self.att_level_car = np.array([7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        self.att_level_aircraft = np.array([7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])


class VehicularMissile(object):
    """车载导弹"""
    def __init__(self):
        self.id = 69
        self.type = BulletType.HeavyMissile
        self.shoot_range = {BopType.Infantry: 0,
                            BopType.Vehicle: 20,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([0, 0, 5, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])


class GunLaunchedMissile(object):
    """炮射导弹"""
    def __init__(self):
        self.id = 84
        self.type = BulletType.HeavyMissile
        self.shoot_range = {BopType.Infantry: 0,
                            BopType.Vehicle: 20,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([0, 0, 5, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])


class HeavyMissile(object):
    """重型导弹"""
    def __init__(self):
        self.id = 73
        self.type = BulletType.HeavyMissile
        self.shoot_range = {BopType.Infantry: 0,
                            BopType.Vehicle: 20,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([0, 0, 5, 5, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8])


class MediumMissile(object):
    """中型导弹"""
    def __init__(self):
        self.id = 74
        self.ids = [74, 83]  # ID号不唯一
        self.type = BulletType.MediumMissile
        self.shoot_range = {BopType.Infantry: 10,
                            BopType.Vehicle: 10,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        self.att_level_soldier = np.array([[2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [3, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])


class SmallMissile(object):
    """小型导弹"""
    def __init__(self):
        self.id = 75
        self.type = BulletType.LightMissile
        self.shoot_range = {BopType.Infantry: 5,
                            BopType.Vehicle: 5,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([3, 3, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        self.att_level_soldier = np.array([[4, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [5, 6, 6, 6, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [7, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [8, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])


class CruiseMissile(object):
    """巡飞弹"""
    def __init__(self):
        self.id = 76
        self.type = BulletType.LightMissile
        self.shoot_range = {BopType.Infantry: 2,
                            BopType.Vehicle: 2,
                            BopType.Aircraft: 0}  # 射程，0表示不可射击
        self.att_level_car = np.array([5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
        self.att_level_soldier = np.array([[4, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                                           [8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
